var app = angular.module(setting.appName);
app.register.controller("UserContactsCtrl", ["$rootScope", "$scope", "$location", "$timeout", "$window", "ToastMessage", "SecurityService", "UserService", function($rootScope, $scope, $location, $timeout, $window, ToastMessage, SecurityService, UserService) {
    $scope.contacts = {},
    $scope.loaded = !1;
    var funs = {
        loadStatus: function() {
            UserService.getContacts().success(function(data) {
                data && data.success && ($scope.contacts = data.result,
                $scope.loaded = !0)
            })
        }
    };
    $scope.saveContacts = function(event) {
        app.util.setDisabled(event.target),
        app.util.loading(event.target, !0);
        var params = $scope.contacts;
        UserService.saveContacts(params).success(function(data) {
            ToastMessage.show(data.message, data.success),
            data && data.success && $timeout(function() {}, 100),
            app.util.setEnabled(event.target),
            app.util.loading(event.target, !1)
        })
    }
    ,
    funs.loadStatus()
}
]);
